package cn.sxt.array;

/**
 * 数组遍历操作
 */
public class Test02 {
    public static void main(String[] args) {
        int[] a = new int[4];
        //循环赋值
        for (int i = 0; i < a.length; i++) {
            a[i] = i*100;
        }
        //循环读取
        for (int i = 0; i < a.length; i++) {
            System.out.println(a[i]);
        }
        System.out.println("##################");
        //使用forEach(因为没有索引所以只能读取元素不能修改元素)
        String[] str = {"aa","bb","cc","dd"};
        for (String m : str) {
            System.out.println(m);
        }
    }
}
